<h1>Au hasard</h1>
<?php
$req = $bdd->query('SELECT * FROM images ORDER BY id DESC LIMIT 1');
$donnees = $req->fetch();
?>
<p><b><?php echo substr($donnees['nom'], 0, 18); ?>..</b><br/>
<?php
$req_cat = $bdd->prepare('SELECT * FROM galeries WHERE id=:id');
$req_cat->execute(array('id' => $donnees['galerie']));
$donnees_cat = $req_cat->fetch();
echo $donnees_cat['nom']; 
?>
</p>
<img src="<?php echo $donnees['image']; ?>" width="250">
<p class="menu"><a href="index.php?page=galeries&id=<?php echo $donnees['id']; ?>">Agrandir</a></p>
<?php
$req->closeCursor();
?>

